Conditionalize building the Xen ACPI driver.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 19 Mar 2006 12:13:35 +0000 (13:13 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 19 Mar 2006 12:13:35 +0000 (13:13 +0100)
Also introduces some cleanups to the Xen build system.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/Post.mk [new file with mode: 0644]
xen/Rules.mk
xen/arch/ia64/Rules.mk
xen/arch/x86/Rules.mk
xen/drivers/Makefile

diff --git a/xen/Post.mk b/xen/Post.mk
new file mode 100644 (file)
index 0000000..e765893
--- /dev/null
@@ -0,0 +1,15 @@
+
+subdirs-all := $(subdirs-y) $(subdirs-n)
+
+default: $(subdirs-y)
+
+.PHONY: FORCE
+FORCE:
+
+%/: FORCE
+       $(MAKE) -C $*
+
+clean: $(addprefix _clean_, $(subdirs-all))
+_clean_%/: FORCE
+       $(MAKE) -C $* clean
+
index 2ece51a8897abd7b2a740e00e6c8fdcace9f60e3..ce519319239ba47636d780ae74dbedccac318a74 100644 (file)
@@ -8,6 +8,15 @@ perfc       ?= n
 perfc_arrays?= n
 crash_debug ?= n
 
+# Hardcoded configuration implications and dependencies.
+# Do this is a neater way if it becomes unwieldy.
+ifeq ($(debug),y)
+verbose := y
+endif
+ifeq ($(perfc_arrays),y)
+perfc := y
+endif
+
 XEN_ROOT=$(BASEDIR)/..
 include $(XEN_ROOT)/Config.mk
 
@@ -32,36 +41,29 @@ S_SRCS  := $(wildcard *.S)
 OBJS    := $(patsubst %.S,%.o,$(S_SRCS))
 OBJS    += $(patsubst %.c,%.o,$(C_SRCS))
 
-# Note that link order matters!
-ALL_OBJS := $(BASEDIR)/common/common.o
-ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
-ALL_OBJS += $(BASEDIR)/drivers/acpi/driver.o
-ifeq ($(ACM_SECURITY),y)
-ALL_OBJS += $(BASEDIR)/acm/acm.o
-CFLAGS += -DACM_SECURITY
-endif
-ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
+ALL_OBJS-y :=
+CFLAGS-y   :=
+subdirs-y  :=
+subdirs-n  :=
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
-CFLAGS += -g -D__XEN__
-
-ifneq ($(debug)$(verbose),nn)
-CFLAGS += -DVERBOSE
-endif
-
-ifeq ($(crash_debug),y)
-CFLAGS += -DCRASH_DEBUG
-endif
+# Note that link order matters!
+ALL_OBJS-y               += $(BASEDIR)/common/common.o
+ALL_OBJS-y               += $(BASEDIR)/drivers/char/driver.o
+ALL_OBJS-$(HAS_ACPI)     += $(BASEDIR)/drivers/acpi/driver.o
+ALL_OBJS-$(ACM_SECURITY) += $(BASEDIR)/acm/acm.o
+ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
 
-ifeq ($(perfc),y)
-CFLAGS += -DPERF_COUNTERS
-ifeq ($(perfc_arrays),y)
-CFLAGS += -DPERF_ARRAYS
-endif
-endif
+CFLAGS-y               += -g -D__XEN__
+CFLAGS-$(ACM_SECURITY) += -DACM_SECURITY
+CFLAGS-$(verbose)      += -DVERBOSE
+CFLAGS-$(crash_debug)  += -DCRASH_DEBUG
+CFLAGS-$(perfc)        += -DPERF_COUNTERS
+CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
 
-CFLAGS := $(strip $(CFLAGS))
+ALL_OBJS := $(ALL_OBJS-y)
+CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y))
 
 %.o: %.c $(HDRS) Makefile
        $(CC) $(CFLAGS) -c $< -o $@
index 41d5e5e9031a0429bd9488b631ba4a0e8f3a1f02..5ecaf67fd546605cfaf278d5c249e8ae638034f1 100644 (file)
@@ -1,6 +1,7 @@
 ########################################
 # ia64-specific definitions
 
+HAS_ACPI := y
 VALIDATE_VT    ?= n
 ifneq ($(COMPILE_ARCH),$(TARGET_ARCH))
 CROSS_COMPILE ?= /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-
index 3921119034ba2076da876554e290b12dd6462018..a83b8b3a07c2de3394901a1cc5b9c50642e38519 100644 (file)
@@ -1,6 +1,8 @@
 ########################################
 # x86-specific definitions
 
+HAS_ACPI := y
+
 #
 # If you change any of these configuration options then you must
 # 'make clean' before rebuilding.
index e0a67e5dc2ea6cdc7c67a2b0311a2110c8043676..e118e2115ac747bfe2b59667cc98e6a4a215210b 100644 (file)
@@ -1,8 +1,6 @@
+include $(BASEDIR)/Rules.mk
 
-default:
-       $(MAKE) -C char
-       $(MAKE) -C acpi
+subdirs-y := char/
+subdirs-$(HAS_ACPI) += acpi/
 
-clean:
-       $(MAKE) -C char clean
-       $(MAKE) -C acpi clean
+include $(BASEDIR)/Post.mk